﻿using EFModel;
using IServices;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Y2.Filters;

namespace Y2.Controllers
{
    [LoginFilter]
    public class engage_resumeController : Controller
    {
        private readonly Iengage_resume he;

        public engage_resumeController(Iengage_resume he)
        {
            this.he = he;
        }

        public IActionResult engage_resume(int? id)
        {
            //判断是否从职位申请进入的简历登记
            if (id <= 0 || id == null)
            {
                id = 0;
            }
            ViewBag.mre_id = id;
            return View();
        }
        //国籍查询
        public async Task<string> Gj()
        {
            return await he.Gj();
        }
        //民族查询
        public async Task<string> Mz()
        {
            return await he.Mz();
        }
        //宗教信仰查询
        public async Task<string> Zjxy()
        {
            return await he.Zjxy();
        }
        //政治面貌查询
        public async Task<string> Zzmm()
        {
            return await he.Zzmm();
        }
        //教育年限查询
        public async Task<string> Jynx()
        {
            return await he.Jynx();
        }
        //学历查询
        public async Task<string> Xl()
        {
            return await he.Xl();
        }
        //专业查询
        public async Task<string> Zy()
        {
            return await he.Zy();
        }
        //特长查询
        public async Task<string> Tc()
        {
            return await he.Tc();
        }
        //爱好查询
        public async Task<string> Ah()
        {
            return await he.Ah();
        }
        //职称查询
        public async Task<string> zc()
        {
            return await he.zc();
        }
        //简历登记添加
        public async Task<int> Insert(engage_resume resume)
        {
            return await he.Insert(resume);
        }
        //职位申请到简历登记的回显查询
        public async Task<IActionResult> Cx(int id)
        {
            return Content(JsonConvert.SerializeObject( await he.Cx(id)));
        }
    }
}
